/**
 * ...
 * @author Yog
 */

package cookinmaddy.client;

import com.yff.controls.FButton;
import com.yff.controls.FControl;
import com.yff.controls.FDiv;
import js.Dom.Document;
import js.Dom.Button;

class TopMenu 
{
	var topmenuDoc : FDiv;
	public static var DOC_ID : String = "";
	var _unitview : UnitView;
	var _ingredientview : IngredientView ;
	var _recipiesview : RecipeView;
	
	public function new(unitview : UnitView, ingredientview : IngredientView, recipeview : RecipeView) 
	{ 
		_unitview = unitview;
		_ingredientview = ingredientview;
		_recipiesview = recipeview;
	}
	
	public function show()
	{
		topmenuDoc = FDiv.getById(DOC_ID);
		
		var btn1 : FButton = new FButton("Units");
		btn1.innerHTML = "Units";
		var self = this;
		btn1.addEvent("click", _unitview.show, null);
		topmenuDoc.appendChild(btn1);
		
		var btn2 : FButton = new FButton("Ingredients");
		btn2.id = "ingredientbutton";
		btn2.addEvent("click", self._ingredientview.show, null);
		topmenuDoc.appendChild(btn2);
		
		var btn3 : FButton = new FButton("Recipes");
		btn3.id = "recipesbutton";
		btn3.addEvent("click", self._recipiesview.show, null);
		topmenuDoc.appendChild(btn3);
	}
}